<?php
require_once dirname(__FILE__) . '/../../../incls/php/dbutils.class.php';
require_once dirname(__FILE__) . '/../../../incls/php/miscutils.class.php';
$page_id = MiscUtils::getParam('i', 0);

$inst_id = MiscUtils::getParam('instid', 0);
$part = MiscUtils::getParam('part', 'pages');
$tag = MiscUtils::getParam('tag', 'pages');

$myPdo = DbUtils::createPdoInst();
$path = basename(dirname(__FILE__));

$cond_vals = new stdClass();
$cond_vals->c = 't.page_id = :v1';
$cond_vals->v = array(':v1' => $page_id);
$tmps = DbUtils::get($myPdo, 'pz2_plugin_instance', NULL, 't.id', 'ASC', NULL, NULL, NULL)->d;
if (count($tmps) > 0) {
  $inst_id = $tmps[0]->id;
}

$data = new stdClass();
$data->system_id = 0;
$cond_vals = new stdClass();
$cond_vals->c = 't.instance_id = :v1';
$cond_vals->v = array(':v1' => $inst_id);
$tmps = DbUtils::get($myPdo, TABLE_NAME_PREFIX_PLUGIN . 'page_manage', NULL, 't.id', 'ASC', NULL, NULL, NULL)->d;
if (count($tmps) > 0) {
  $system_id = $tmps[0]->system_id;
} else {
  $system_id = 0;
}

//$path = 'mods/' . basename(dirname(__FILE__));
$myPdo = DbUtils::createPdoInst();
$data = new stdClass();
$cond_vals = new stdClass();
$cond_vals->c = 't.id = :v1';
$cond_vals->v = array(':v1' => $system_id);
$tmp = DbUtils::get($myPdo, 'pz2_sys', $cond_vals, NULL, NULL, NULL, NULL, NULL)->d;
if (count($tmp) > 0) {
  $data->sys = $tmp[0];
}

?>
<style>
* {
  font-family: Trebuchet MS;
  font-size: 12px;
}
.clearfix:after {
  clear: both;
  content: ".";
  display: block;
  height: 0;
  visibility: hidden;
}
.tabPanel {
  margin-top: 10px;
  overflow: visible;
  padding-left: 5px;
}
.tabPanel .active {
  background: url("assets/imgs/tabs_on.gif") no-repeat scroll 0 0 transparent;
  color: #000000;
  display: block;
  font-weight: bold;
  height: 28px;
  margin-bottom: -4px;
  margin-top: -8px;
  padding-top: 6px;
  position: relative;
  width: 117px;
}
.tabPanel div {
  background: url("assets/imgs/tabs_common.gif") no-repeat scroll 0 0 transparent;
  color: #666666;
  cursor: pointer;
  display: block;
  float: left;
  height: 17px;
  padding: 4px 2px;
  text-align: center;
  width: 91px;
}
.clear {
  border-top: 1px solid #aaa !important;
  margin-top: -1px;
  margin-bottom: 5px;
}
</style>
<div>
  <?php include 'index_' . $part .'.php'; ?>
</div>